# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Patryk Kowalczyk < patryk at kowalczyk dot ws>

pkgname=spice
pkgver=0.15.1
pkgrel=2
pkgdesc="SPICE server"
arch=('x86_64')
url="https://www.spice-space.org"
license=('LGPL2.1')
depends=('pixman' 'opus' 'libjpeg-turbo' 'glib2' 'libsasl' 'lz4' 'spice-protocol' 'libcacard')
makedepends=('meson' 'python-six' 'python-pyparsing')
checkdepends=('gdk-pixbuf2' 'glib-networking')
provides=('libspice-server.so')
source=("https://www.spice-space.org/download/releases/spice-server/$pkgname-$pkgver.tar.bz2"{,.sig})
sha256sums=('ada9af67ab321916bd7eb59e3d619a4a7796c08a28c732edfc7f02fc80b1a37a'
            'SKIP')
validpgpkeys=('206D3B352F566F3B0E6572E997D9123DE37A484F') # Victor Toso <victortoso@redhat.com>

prepare() {
  cd $pkgname-$pkgver
  sed -i "s/if not version_info.contains('git')/if version_info.length() >= 4/" server/meson.build

  sed -i "/meson-dist/d" meson.build
}

build() {
  arch-meson "$pkgname-$pkgver" build -D gstreamer=no
  ninja -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  DESTDIR="$pkgdir" meson install -C build
}
